using Acme.BookStore.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Volo.Abp.EntityFrameworkCore.Modeling;

namespace Acme.BookStore.EntityFrameworkCore.Configurations
{
    public class ShopWhereConfiguration : IEntityTypeConfiguration<ShopWhere>
    {
        public void Configure(EntityTypeBuilder<ShopWhere> builder)
        {
            builder.ToTable("ShopWhereTable");
            
            // 配置复合主键
            builder.HasKey(x => new { x.OwnerCode, x.ProductCode, x.ProductSku });
            
            // 配置其他属性
            builder.Property(x => x.OwnerCode).IsRequired().HasMaxLength(50);
            builder.Property(x => x.ProductCode).IsRequired().HasMaxLength(50);
            builder.Property(x => x.ProductSku).IsRequired().HasMaxLength(50);
            builder.Property(x => x.ProductName).IsRequired().HasMaxLength(100);
            builder.Property(x => x.BaseUnit).HasMaxLength(20);
        }
    }
} 